# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-dbus
_pkgname=dbus-python
pkgver=1.3.2
pkgrel=4
pkgdesc="Python3 bindings for DBUS"
url="https://www.freedesktop.org/wiki/Software/DBusBindings"
arch="all"
license="MIT"
depends="python3"
depends_dev="py3-dbus"
makedepends="dbus-glib-dev python3-dev meson"
checkdepends="bash dbus py3-gobject3 py3-tappy"
subpackages="$pkgname-dev"
source="https://dbus.freedesktop.org/releases/dbus-python/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	abuild-meson \
		-Dtests="$(want_check && echo true || echo false)" \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	local pyminor="$(python3 -c 'import sys; print("%i" % sys.version_info.minor)')"

	mv dbus_python.egg-info/ "$pkgdir"/usr/lib/python3.$pyminor/site-packages/dbus_python-$pkgver-py3.$pyminor.egg-info/
}

sha512sums="
9b2885c9c2914142c72487f766b1cdd28a255d9f5a87eaf8f4eb420c6e096a77f210ac5a4fac9843c6531974872880cc28b7e45940e198856e984dcc0715519a  dbus-python-1.3.2.tar.gz
"
